package pro.survey.analyzer;

import javafx.event.EventHandler;
import javafx.scene.chart.Axis;
import javafx.scene.chart.BarChart;
import javafx.scene.control.Label;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import pro.survey.analyzer.note.window.NoteWindow;

/**
 *
 * @author Adrian
 */
public class BarChartWithNote extends VBox {
    
    private BarChart barChart;
    private Trans label;
    
    public BarChartWithNote(Axis xAxis, Axis yAxis) {
        barChart = new BarChart<String, Number>(xAxis, yAxis);
        final Label label = new Label();
        this.getChildren().addAll(barChart,label);
        this.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){
                    if(mouseEvent.getClickCount() == 2){
                        NoteWindow.getInstance().init(label);
                    }
                }
            }
        });
    }
    public BarChart getChart() {
        return barChart;
    }
}
